package com.dove.feign;

import com.dove.pojo.Dept;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;

import java.util.List;

//fallbackFactory 开启服务降级
@FeignClient(value = "SPRING-PROVIDER-DEPT-8001",fallbackFactory = DeptFeignServiceFactory.class)
@Component
public interface DeptFeignService {
    @PostMapping("/dept/add")
    public boolean add(Dept dept);

    @GetMapping("/dept/get/{id}")
    public Dept get(@PathVariable("id") Long id);

    @GetMapping("/dept/list")
    public List<Dept> queryAll();
}

